<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
	<script type="text/javascript">
	var category = "${cate}";
	$(function(){
		$("[name='cate'] option").each(function(){
			if($(this).val() == category)
				$(this).attr("selected","selected");
		});
		$("[name='cate']")
			.change(function(){
				$("form").submit();
			}
		);
	});
	</script>    
	<h2>상품</h2>
	<form name="itemForm">
	<div style="width:100%;height:20px;float:left;">
		<select name="cate">
			<option value="">전체</option>
			<option value="TOP">TOP</option>
			<option value="OUTER">OUTER</option>
			<option value="DRESS">DRESS</option>
			<option value="PANTS">PANTS</option>
			<option value="SKIRTS">SKIRTS</option>
			<option value="BAG">BAG</option>
			<option value="SHOES">SHOES</option>
		</select>
	</div>
	<div style="width:100%;float:left;">
	<table border="1" cellspacing="0" width="100%" class="bbs">
	<thead>
		<tr>
			<th align="center" width="100">카테고리</th>
			<th>상품명</th>
			<th align="center" width="100">판매가</th>
			<th align="center" width="100">등록일</th>
		</tr>
	</thead>
	<tbody>
		<!-- 반복문시작 -->
		<c:forEach items="${list}" var="lists">
		<c:url var="writePage" value="item_modify_form.action">
			<c:param name="itemNo">${lists.itemno}</c:param>
			<c:param name="currentPage">${currentPage}</c:param>
			<c:param name="mode">u</c:param>
		</c:url>
		<tr>
			<td align="center">${lists.cate}</td>
			<td align="center"><a href="${writePage}">${lists.itemname}</a></td>
			<td align="center">${lists.price}</td>
			<td align="center">${lists.regdate}</td>
		</tr>
		</c:forEach>
		<!-- 반복문끝-->
	</tbody>
	<tfoot>
		<tr>
			<td align="center" colspan="4"> ${pagingHtml}</td>
		</tr>
		<tr>
			<td align="right" colspan="4">
				<input type="button" value="상품등록" class="button" onclick="location.href='item_write_form.action?currentPage=${currentPage}'"/>
			</td>
		</tr>
	</tfoot>
	</table>
	</div>
	</form>